package com.ccys.cms.controller.masterData;

import com.ccys.cms.service.masterData.CompanyService;
import com.ccys.common.constants.TouristApi;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.masterData.CompanyIdDto;
import com.ccys.db.dto.masterData.CompanyPageQueryDto;
import com.ccys.db.dto.masterData.CompanySaveDto;
import com.ccys.db.vo.masterData.CompanyPageQueryVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @program: WhiteCoat
 * @description: 集团接口
 * @author: ZhangJingCan
 * @create: 2023-12-14 10:38
 **/

@RestController
@RequestMapping("masterData")
@Api(tags = "masterData-集团接口")
public class CompanyController {

    @Autowired
    private CompanyService companyService;



    
    @PostMapping("company")
    @ApiOperation("保存集团")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "groupId", value = "groupId", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "companyName", value = "companyName", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "companyType", value = "0 third 1 self", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "companyAddress", value = "companyAddress", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "companyEmail", value = "companyEmail", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "companyPhone", value = "companyPhone", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "gstRegistrationNo", value = "gstRegistrationNo", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "gstRegistered", value = "0/1", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "licenceNo", value = "licenceNo", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "companyLogo", value = "companyLogo", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "poweredByMedicalCertification", value = "0/1", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "poweredByReferralLetter", value = "0/1", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "poweredByMemo", value = "0/1", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "poweredByReceipt", value = "0/1", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "poweredByPrescription", value = "0/1", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "poweredByOtherService", value = "0/1", required = false, dataType = "string", paramType = "query"),
    })
    public ResponseResult saveCompany(@ApiIgnore CompanySaveDto dto) {
        return companyService.saveCompany(dto);
    }



    @PutMapping("company")
    @ApiOperation("修改集团")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "groupId", value = "groupId", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "companyName", value = "companyName", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "companyType", value = "0 third 1 self", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "companyAddress", value = "companyAddress", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "companyEmail", value = "companyEmail", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "companyPhone", value = "companyPhone", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "gstRegistrationNo", value = "gstRegistrationNo", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "gstRegistered", value = "0/1", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "licenceNo", value = "licenceNo", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "companyLogo", value = "companyLogo", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "poweredByMedicalCertification", value = "0/1", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "poweredByReferralLetter", value = "0/1", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "poweredByMemo", value = "0/1", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "poweredByReceipt", value = "0/1", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "poweredByPrescription", value = "0/1", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "poweredByOtherService", value = "0/1", required = false, dataType = "string", paramType = "query"),
    })
    public ResponseResult edit(@ApiIgnore CompanySaveDto dto) {
        return companyService.saveCompany(dto);
    }
    @DeleteMapping("company")
    @ApiOperation("根据ID删除集团")
    public ResponseResult deleteCompany(CompanyIdDto dto) {
        return companyService.deleteCompany(dto);
    }

    
    @GetMapping("company")
    @ApiOperation("分页查询集团")
    public ResponseResult<PageInfo<CompanyPageQueryVo>, Object> findPageCompany(CompanyPageQueryDto dto) {
        return companyService.findPageCompany(dto);
    }

    
    @PutMapping("company/status")
    @ApiOperation("根据ID修改集团状态")
    public ResponseResult updateCompanyStatus(CompanyIdDto dto) {
        return companyService.updateCompanyStatus(dto);
    }

}
